package com.hiyee.exception;

import com.hiyee.response.ResponseStatusEnum;

/**
 * 自定义异常处理
 * 目的：解耦、service 与 controller 错误的解耦，不会被 service 返回的类型而限制
 *
 * @author WangBin
 */
public class BusinessException extends RuntimeException {

    private ResponseStatusEnum responseStatusEnum;

    public BusinessException(ResponseStatusEnum responseStatusEnum) {
        super("异常状态：" + responseStatusEnum.getStatus()
                + ",异常信息：" + responseStatusEnum.getMsg());
        this.responseStatusEnum = responseStatusEnum;
    }

    public ResponseStatusEnum getResponseStatusEnum() {
        return responseStatusEnum;
    }

    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
        this.responseStatusEnum = responseStatusEnum;
    }
}
